package com.linran.utils.utils;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.util.Scanner;

/**
 * 输入：3+2*{1+2*[-4/(8-6)+7]}
 * 输出：25
 * @author Alan Zou
 * @date 2022/7/27
 */
public class CalculatorUtils {
    public static void main(String[] args) throws ScriptException {
        Scanner scan = new Scanner(System.in);
        String input = scan.nextLine();
        input = input.replace("[", "(");
        input = input.replace("{", "(");
        input = input.replace("}", ")");
        input = input.replace("]", ")");
        ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName("nashorn");
        System.out.println(scriptEngine.eval(input));
    }
}
